home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / mui / bcc.lha / BCC / Examples / BCCopts / App.bc < prev    next >
Encoding:
Text File  |  1997-06-23  |  4.8 KB  |  202 lines

  1. #include <proto/dos.h>
  2. #include <proto/gadtools.h>
  3.  
  4. #include "App.bh"
  5.  
  6. #include "Popdir.h"
  7.  
  8. void myputch( void );
  9.  
  10. static const char *centr[] = {
  11.     "MUI",
  12.     "BCC",
  13.     NULL
  14. };
  15.  
  16. static const char *ce2[] = {
  17.     "version",
  18.     "noversion",
  19.     NULL
  20. };
  21.  
  22. static const char *ce3[] = {
  23.     "noverbose",
  24.     "verbose",
  25.     NULL
  26. };
  27.  
  28. static const char *ce4[] = {
  29.     "noforcetrans",
  30.     "forcetrans",
  31.     NULL
  32. };
  33.  
  34.  
  35. cleardata Method App::App() :
  36.         MUIA_Application_Author, "RafaĆ® Mantiuk",
  37.         MUIA_Application_Base, "BCCOPTS",
  38.         MUIA_Application_Title, "BCCOpts",
  39.         MUIA_Application_Version, "$VER: BCCOPTS 1.1 "__AMIGADATE__,
  40.         MUIA_Application_Copyright, "Copyright (c)1997, RafaĆ® Mantiuk",
  41.         MUIA_Application_Description, "Set options for BCC.",
  42.         SubWindow, win = WindowObject,
  43.             MUIA_Window_Title, "Set BCC options (GUI v1.1)",
  44.             MUIA_Window_ID, MAKE_ID('M', 'A', 'I', 'N'),
  45.             WindowContents, GroupObject,
  46.                 MUIA_Background, MUII_WindowBack,
  47.                 Child, GroupObject, 
  48.                     MUIA_Background, MUII_GroupBack,
  49.                     MUIA_Frame, MUIV_Frame_Group,
  50.                     MUIA_Group_Columns, 2,
  51.                     Child, GroupObject, 
  52.                         MUIA_FrameTitle, "Global",
  53.                         MUIA_Frame, MUIV_Frame_Group,
  54.                         Child, deftype = CycleObject,
  55.                             MUIA_Cycle_Entries, centr,
  56.                             MUIA_CycleChain, TRUE,
  57.                             MUIA_Background, MUII_TextBack,
  58.                         End,
  59.                         Child, HGroup,
  60.                             Child, Label2( "Tag base" ),
  61.                             Child, tagbase = StringObject,
  62.                                 MUIA_Frame, MUIV_Frame_String,
  63.                                 MUIA_CycleChain, TRUE,
  64.                                 MUIA_String_MaxLen, 5,
  65.                                 MUIA_String_Accept, "1234567890abcdefABCDEFnoe",
  66.                                 MUIA_String_Contents, "none",
  67.                             End,
  68.                         End,
  69.                     End,
  70.                     Child, GroupObject, 
  71.                         MUIA_FrameTitle, "Include files dir",
  72.                         MUIA_Frame, MUIV_Frame_Group,
  73.                         Child, PopdirObject,
  74.                             MUIA_Popstring_String, incdir = StringObject,
  75.                                 MUIA_Frame, MUIV_Frame_String,
  76.                                 MUIA_CycleChain, TRUE,
  77.                                 MUIA_String_MaxLen, 80,
  78.                                 MUIA_String_Contents, "ENV:bcc/",
  79.                             End,
  80.                             MUIA_Popstring_Button, PopButton(MUII_PopFile),
  81.                         End,
  82.                     End,
  83.                     Child, GroupObject, 
  84.                         MUIA_FrameTitle, "Report",
  85.                         MUIA_Frame, MUIV_Frame_Group,
  86.                         Child, noversion = CycleObject,
  87.                             MUIA_Cycle_Entries, ce2,
  88.                             MUIA_CycleChain, TRUE,
  89.                             MUIA_Background, MUII_TextBack,
  90.                         End,
  91.                         Child, verbose = CycleObject,
  92.                             MUIA_Cycle_Entries, ce3,
  93.                             MUIA_CycleChain, TRUE,
  94.                             MUIA_Background, MUII_TextBack,
  95.                         End,
  96.                     End,
  97.                     Child, GroupObject, 
  98.                         MUIA_FrameTitle, ".bh files",
  99.                         MUIA_Frame, MUIV_Frame_Group,
  100.                         Child, forcetrans = CycleObject,
  101.                             MUIA_Cycle_Entries, ce4,
  102.                             MUIA_CycleChain, TRUE,
  103.                             MUIA_Background, MUII_TextBack,
  104.                         End,
  105.                     End,
  106.                 End,
  107.                 Child, GroupObject,
  108.                     MUIA_Background, MUII_GroupBack,
  109.                     MUIA_FrameTitle, "Creators",
  110.                     MUIA_Frame, MUIV_Frame_Group,
  111.                     Child, createinitcl = KeyButton( "Create <initcl> files", 'i' ),
  112.                 End,
  113.                 Child, GroupObject,
  114.                     MUIA_Group_Horiz, TRUE,
  115.                     Child, savedef = KeyButton( "Save as default", 'd' ),
  116.                     Child, save = KeyButton( "Save", 's' ),
  117.                     Child, cancel = KeyButton( "Cancel", 'c' ),
  118.                 End,
  119.             End,
  120.             MUIA_Window_Menustrip, MenustripObject,
  121.                 MUIA_Family_Child, MenuObject,
  122.                     MUIA_Menu_Title, "Project",
  123.                     MUIA_Family_Child, maboutmui = MenuitemObject,
  124.                         MUIA_Menuitem_Title, "About MUI...",
  125.                     End,
  126.                     MUIA_Family_Child, MenuitemObject,
  127.                         MUIA_Menuitem_Title, NM_BARLABEL,
  128.                     End,
  129.                     MUIA_Family_Child, mquit = MenuitemObject,
  130.                         MUIA_Menuitem_Title, "Quit",
  131.                         MUIA_Menuitem_Shortcut, "Q",
  132.                     End,
  133.                 End,
  134.             End,
  135.         End
  136. {
  137.  
  138.  
  139.     win->_Notify( 
  140.         MUIA_Window_CloseRequest, TRUE,
  141.         obj, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );
  142.  
  143.     mquit->_Notify(
  144.         MUIA_Menuitem_Trigger, MUIV_EveryTime,
  145.         obj, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );
  146.  
  147.     maboutmui->_Notify(
  148.         MUIA_Menuitem_Trigger, MUIV_EveryTime,
  149.         obj, 2, MUIM_Application_AboutMUI, win );
  150.  
  151.     cancel->_Notify( 
  152.         MUIA_Pressed, TRUE,
  153.         obj, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );
  154.  
  155.     save->_Notify( 
  156.         MUIA_Pressed, TRUE,
  157.         obj, 2, MUIM_App_SaveOpts, 0 );
  158.  
  159.     savedef->_Notify( 
  160.         MUIA_Pressed, TRUE,
  161.         obj, 2, MUIM_App_SaveOpts, 1 );
  162.  
  163.     createinitcl->_Notify( 
  164.         MUIA_Pressed, TRUE,
  165.         obj, 1, MUIM_App_CreateInitcl );
  166.  
  167.     tagbase->_Notify(
  168.         MUIA_String_Acknowledge, MUIV_EveryTime,
  169.         obj, 2, MUIM_App_NewTagBase, MUIV_TriggerValue );
  170.     
  171.  
  172.     obj->LoadOpts();
  173.  
  174.     win->Open = TRUE;
  175.  
  176. }
  177.  
  178. nodata Method App::CreateInitcl()
  179. {
  180.     obj->Application_Sleep = TRUE;
  181.  
  182.     Execute( "BCC initcl", 0, Output() );
  183.  
  184.     obj->Application_Sleep = FALSE;
  185. }
  186.  
  187. Method App::NewTagBase( char *txt )
  188. {
  189.  char buf[6];
  190.  short i;
  191.  
  192.     if( !*txt ) tagbase->Contents = "none";
  193.     else 
  194.     if( strlen( txt ) < 4 ) {
  195.         strcpy( buf, txt );
  196.         for( i = strlen( txt ); i < 4; i++ ) buf[i] = '0';
  197.         buf[5] = 0;
  198.         tagbase->Contents = buf;
  199.     }
  200.  
  201. }
  202.